<!--
 * @Author: early-autumn
 * @Date: 2020-05-15 11:42:21
 * @LastEditors: early-autumn
 * @LastEditTime: 2020-05-30 11:55:15
 -->
<template>
  <div class="app-container">
    <el-page-header :style="{ marginBottom: '20px' }" @back="routerBack">
      <div slot="content" class="content">
        <el-form inline>
          <el-form-item :label="patient.name"></el-form-item>
          <el-form-item :label="`${patient.age}`"></el-form-item>
          <el-form-item :label="sexEnum[patient.sex]"></el-form-item>
          <el-form-item label="手机号：">{{
            patient.phoneNumber
          }}</el-form-item>
          <el-form-item label="病历：">{{ patient.caseNumber }}</el-form-item>
          <el-form-item label="TC：">{{ patient.tcName }}</el-form-item>
          <el-form-item label="医生：">{{ patient.doctorName }}</el-form-item>
        </el-form>
      </div>
    </el-page-header>
    <audit-discount :audit="audit" :veri-level="veriLevel" />
  </div>
</template>

<script>
import { sexEnum } from '@/utils/enums'
import routerBack from '@/mixins/routerBack'
import auditDiscount from '../discountAudit/auditDiscount'
import { decode } from '@/utils/utils'
import { getPerson } from '@/api/services/person'
import { mapState } from 'vuex'

export default {
  name: 'AuditDetails',
  components: {
    auditDiscount,
  },
  mixins: [routerBack],
  data() {
    return {
      patient: {},
      audit: {},
    }
  },
  computed: {
    sexEnum() {
      return sexEnum
    },
    ...mapState({
      veriLevel: (state) => state.user.veriLevel,
    }),
  },
  mounted() {
    this.queryData()
    this.getPerson()
  },
  methods: {
    async queryData() {
      const { query } = await decode(this.$route.query.redirect)
      this.audit = query
    },
    async getPerson() {
      const { data } = await getPerson(this.$route.query.id)
      this.patient = data
    },
  },
}
</script>

<style lang="scss" scoped>
.content {
  margin-top: -6px;
  height: 20px;
}
</style>
